﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Xml;

namespace HelloASPX
{
    public partial class ProductList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null)
            {
                HttpContext.Current.Response.Write("<script>alert('请先登陆！');location='Login.aspx'</script>");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            Response.Cookies["ProductId"].Value = btn.CommandArgument.ToString();
            Response.Redirect("ProductDetails.aspx");
        }

        protected void AddProduct_Click(object sender, EventArgs e)
        {
            Session["username"] = Request["username"];
            Response.Redirect("AddProduct.aspx");
        }

        protected void useradminButton_Click(object sender, EventArgs e)
        {
            Session["username"] = Request["username"];
            Response.Redirect("Default.aspx");
        }
    }
}